<?php

class Home extends CI_Controller
{

	public function index()
	{
		if($this->ion_auth->logged_in())
		{
			$data['logged_in_username'] = "guest";
			$user = $this->ion_auth->get_user();

			if(strlen($user->username))
			{
				$data['logged_in_username'] = $user->username;
			}
			else if(strlen($user->email))
			{
				$temp = stristr($user->email,"@");
				if(strlen($temp))
				{
					$temp = str_replace($temp,'',$user->email);
					if(strlen($temp))
						$data['logged_in_username'] = $temp;
				}

			}

		}
		
		$data['css_file_path'] = '/application/css/homepage.css';
		$data['title'] = 'Delicious\'';

		$this->load->view('header',$data);
		$this->load->view('homepage');
		$this->load->view('footer');
		
	}
}

?>